// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   LogUtil.java

package com.vandagroup.common.util;

import com.vandagroup.common.init.Log4JInit;
import java.io.File;
import java.io.PrintStream;
import java.util.*;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class LogUtil
{

    public static final String CONFIG_FILE = "com.vandagroup.common.resources.log4j";
    public static String LOG_PATH;
    private static ResourceBundle myResource;

    public LogUtil()
    {
    }

    protected static Logger getLogger(String className)
    {
        Logger cat = Logger.getLogger(className);
        return cat;
    }

    public static Logger getLogger(Class a_Class)
    {
        return getLogger(a_Class.getName());
    }

    public static Logger getLogger(Object a_Object)
    {
        return getLogger(a_Object.getClass().getName());
    }

    static 
    {
        LOG_PATH = System.getProperty("user.dir") + System.getProperty("file.separator");
        try
        {
            myResource = ResourceBundle.getBundle("com.vandagroup.common.resources.log4j");
            Properties logProperties = new Properties();
            String tempKey = "";
            for(Enumeration e = myResource.getKeys(); e.hasMoreElements(); logProperties.put(tempKey, myResource.getString(tempKey)))
                tempKey = (String)e.nextElement();

            LOG_PATH = Log4JInit.getLogFilePath();
            File logFile = new File(LOG_PATH);
            logFile.mkdirs();
            logProperties.setProperty("log4j.appender.AppAppender.File", LOG_PATH + File.separator + "FXQApp.log");
            PropertyConfigurator.configure(logProperties);
        }
        catch(MissingResourceException mre)
        {
            mre.printStackTrace();
            System.out.println("com.vandagroup.common.resources.log4j properties file cannot be found");
        }
    }
}
